<?php

use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Route;
use Dcat\Admin\Admin;

Admin::routes();

Route::group([
    'prefix'     => config('admin.route.prefix'),
    'namespace'  => config('admin.route.namespace'),
    'middleware' => config('admin.route.middleware'),
], function (Router $router) {
    $router->get('/', 'HomeController@index');
    $router->get('/datamonitored', 'DataMonitoredController@index');
    $router->get('/datamonitored/sup', 'DataMonitoredController@sup');
    $router->resource('Company', CompanyController::class);
    $router->resource('InfoModel', InformationModelController::class);
    $router->resource('Project', ProjectController::class);
    $router->resource('Report', ReportController::class);
    $router->resource('Media', MediaController::class);
    $router->resource('MediaAudit', MediaAuditController::class);
    $router->resource('Layer', LayerController::class);
    $router->resource('Device', DeviceController::class);
    $router->resource('WkEditPoint', Weikong\CreatePointController::class);

    $router->resource('DeviceType', DeviceTypeController::class);
    $router->resource('ThermalLog', ThermalLogController::class);
    $router->resource('ProjectAuth', ProjectAuthController::class);
    // $router->any('device/form1', 'DeviceController@form1');
    $router->get('Device/creates/{type}','DeviceController@creates');
    $router->get('report/{pid}','ReportController@index');
    $router->get('report/{pid}/create', 'ReportController@create');
    $router->post('report/{pid}', 'ReportController@store');
    $router->get('report/{pid}/{id}/edit', 'ReportController@edit');
    $router->put('report/{pid}/{id}', 'ReportController@update');
    $router->get('InputStepForm', 'InputStepFormController@index');
    $router->get('downloadfile/{id}','InformationModelController@downloadfile');

    $router->get('RetrofitInfo', 'FileModel\RetrofitInformationController@index');
    $router->any('RetrofitInfostep', 'FileModel\RetrofitInformationController@step');
    $router->any('RetrofitInfostep/create', 'FileModel\RetrofitInformationController@index');
    $router->any('RetrofitInfo/list/{type}', 'FileModel\RetrofitInformationController@list');

    $router->get('PowerInstallation', 'FileModel\PowerInstallationController@index');
    $router->any('PowerInstallationstep', 'FileModel\PowerInstallationController@step');
    $router->any('PowerInstallationstep/create', 'FileModel\PowerInstallationController@index');
    $router->any('PowerInstallation/list/{type}', 'FileModel\PowerInstallationController@list');

    $router->get('ProjectDailyReport', 'FileModel\ProjectDailyReportController@index');
    $router->any('ProjectDailyReportstep', 'FileModel\ProjectDailyReportController@step');
    $router->any('ProjectDailyReportstep/create', 'FileModel\ProjectDailyReportController@index');
    $router->any('ProjectDailyReport/list/{type}', 'FileModel\ProjectDailyReportController@list');

    $router->get('PerformanceTest', 'FileModel\PerformanceTestController@index');
    $router->any('PerformanceTeststep', 'FileModel\PerformanceTestController@step');
    $router->any('PerformanceTeststep/create', 'FileModel\PerformanceTestController@index');
    $router->any('PerformanceTest/list/{type}', 'FileModel\PerformanceTestController@list');

    $router->get('InstallInspection', 'FileModel\InstallInspectionController@index');
    $router->any('InstallInspectionstep', 'FileModel\InstallInspectionController@step');
    $router->any('InstallInspectionstep/create', 'FileModel\InstallInspectionController@index');
    $router->any('InstallInspection/list/{type}', 'FileModel\InstallInspectionController@list');

    $router->get('TrainingRecords', 'FileModel\TrainingRecordsController@index');
    $router->any('TrainingRecordsstep', 'FileModel\TrainingRecordsController@step');
    $router->any('TrainingRecordsstep/create', 'FileModel\TrainingRecordsController@index');
    $router->any('TrainingRecords/list/{type}', 'FileModel\TrainingRecordsController@list');

    $router->get('AfterSalesService', 'FileModel\AfterSalesServiceController@index');
    $router->any('AfterSalesServicestep', 'FileModel\AfterSalesServiceController@step');
    $router->any('AfterSalesServicestep/create', 'FileModel\AfterSalesServiceController@index');
    $router->any('AfterSalesService/list/{type}', 'FileModel\AfterSalesServiceController@list');

    $router->get('EngineeringCommissioning', 'FileModel\EngineeringCommissioningController@index');
    $router->any('EngineeringCommissioningstep', 'FileModel\EngineeringCommissioningController@step');
    $router->any('EngineeringCommissioningstep/create', 'FileModel\EngineeringCommissioningController@index');
    $router->any('EngineeringCommissioning/list/{type}', 'FileModel\EngineeringCommissioningController@list');

    $router->get('ProjectRegister', 'FileModel\ProjectRegisterController@index');
    $router->any('ProjectRegisterstep', 'FileModel\ProjectRegisterController@step');
    $router->any('ProjectRegisterstep/create', 'FileModel\ProjectRegisterController@index');
    $router->any('ProjectRegister/list/{type}', 'FileModel\ProjectRegisterController@list');

    $router->get('EquipmentExceptionRecord', 'FileModel\EquipmentExceptionRecordController@index');
    $router->any('EquipmentExceptionRecordstep', 'FileModel\EquipmentExceptionRecordController@step');
    $router->any('EquipmentExceptionRecordstep/create', 'FileModel\EquipmentExceptionRecordController@index');
    $router->any('EquipmentExceptionRecord/list/{type}', 'FileModel\EquipmentExceptionRecordController@list');

    $router->get('MoveNotes', 'FileModel\MoveNotesController@index');
    $router->any('MoveNotesstep', 'FileModel\MoveNotesController@step');
    $router->any('MoveNotesstep/create', 'FileModel\MoveNotesController@index');
    $router->any('MoveNotes/list/{type}', 'FileModel\MoveNotesController@list');

    $router->get('ChangeShifts', 'FileModel\ChangeShiftsController@index');
    $router->any('ChangeShiftsstep', 'FileModel\ChangeShiftsController@step');
    $router->any('ChangeShiftsstep/create', 'FileModel\ChangeShiftsController@index');
    $router->any('ChangeShifts/list/{type}', 'FileModel\ChangeShiftsController@list');

    $router->get('Scheme', 'FileModel\SchemeController@index');
    $router->any('Schemestep', 'FileModel\SchemeController@step');
    $router->any('Schemestep/create', 'FileModel\SchemeController@index');
    $router->any('Scheme/list/{type}', 'FileModel\SchemeController@list');

    $router->get('SpareParts', 'FileModel\SparePartsController@index');
    $router->any('SparePartsstep', 'FileModel\SparePartsController@step');
    $router->any('SparePartsstep/create', 'FileModel\SparePartsController@index');
    $router->any('SpareParts/list/{type}', 'FileModel\SparePartsController@list');

    $router->get('Technology', 'FileModel\TechnologyController@index');
    $router->any('Technologystep', 'FileModel\TechnologyController@step');
    $router->any('Technologystep/create', 'FileModel\TechnologyController@index');
    $router->any('Technology/list/{type}', 'FileModel\TechnologyController@list');

    $router->get('step/create', 'InputStepFormController@index');
    // $router->post('step', 'InputStepFormController@index');
    $router->any('step', 'InputStepFormController@step');
    $router->get('device/{id}','DeviceController@Pdevice');
    $router->get('project/{id}','ProjectController@Pproject');
    $router->get('DeviceLog', 'DeviceLogController@index');
    $router->get('planeSelect', 'DeviceController@planeSelect');
    $router->get('planeSelectc', 'CabinetController@planeSelectc');
    $router->get('device/location/{id}','DeviceController@location');
    $router->post('locationSave','DeviceController@locationSave');
    $router->get('project/ProjectLocation/{id}','ProjectController@ProjectLocation');
    $router->get('project/ProjectLocationView/{id}','ProjectController@ProjectLocationView');
    $router->post('ProjectLocationSave','ProjectController@ProjectLocationSave');
    $router->post('getLocationsData', 'ProjectController@getLocationsData');
    $router->post('ReleaseAlarm', 'ProjectController@ReleaseAlarm');
    $router->post('setLocationsAutoRefresh', 'ProjectController@setLocationsAutoRefresh');
    //维控分级添加
    $router->get('WkCreateGroup','Weikong\CreateGroupController@create');
    $router->any('PostGroup','Weikong\CreateGroupController@store');
    $router->get('WkCreatePoint','Weikong\CreatePointController@create');
    $router->any('WkEditPoint/{id?}/edit','Weikong\CreatePointController@edit');
    $router->any('PointEditPost/{id?}','Weikong\CreatePointController@update');
    $router->any('PostPoint','Weikong\CreatePointController@store');

    $router->any('postAudit','MediaController@postAudit');
    $router->any('step/files', 'FileController@handle');

    // $router->any('media','MediaController@index');
    // $router->any('media/index/create','MediaController@create');
    $router->any('Media/audit','MediaController@audit');
    //项目概况首页
    $router->get('projectDesc', 'ProjectDescController@index');
    $router->post('setAutoRefresh', 'HomeController@setAutoRefresh');
    $router->post('setCompareDate', 'HomeController@setCompareDate');

    //管理员账号权限管理
    $router->resource('admin-accounts', AdminAccountController::class);
    $router->resource('admin-roles', AdminRoleController::class);

    //锁
    $router->resource('locks', LockController::class);
    $router->get('lock-records/{lockId?}', 'LockRecordController@index');

    //项目图层
    $router->get('project-layer/getBoxes', 'ProjectLayerController@getBoxes');
    $router->get('project-layer/getCabinets', 'ProjectLayerController@getCabinets');
    $router->get('project-layer/getDetail', 'ProjectLayerController@getDetail');
    $router->get('project-layer/{projectId}/{layerId?}', 'ProjectLayerController@index');
    $router->post('project-layer/add-layer', 'ProjectLayerController@addLayer');
    $router->post('project-layer/add-point', 'ProjectLayerController@addPoint');
    $router->post('project-layer/save-coordinate', 'ProjectLayerController@saveCoordinate');

    //电源柜
    $router->resource('cabinets', CabinetController::class);
    $router->get('cabinet-children/{pid}', 'CabinetChildrenController@index');
    $router->get('cabinet-children/{pid}/{id}', 'CabinetChildrenController@show');
    $router->get('cabinet-children/{pid}/{id}/edit', 'CabinetChildrenController@edit');
    $router->put('cabinet-children/{pid}/{id}', 'CabinetChildrenController@update');
    $router->delete('cabinet-children/{pid}/{id}', 'CabinetChildrenController@destroy');
    //电源柜数据
    $router->get('cabinet-realtime/{projectId?}/{id?}', 'CabinetDataController@realtime');
    $router->post('getCabinetRealtimeDataByBox', 'CabinetDataController@getCabinetRealtimeDataByBox');
    $router->get('cabinet-realtime-detail/{projectId?}/{id?}', 'CabinetDataController@realtimeDetail');
    $router->post('getCabinetRealtimeDetailData', 'CabinetDataController@getCabinetRealtimeDetailData');
    $router->post('setCabinetDetailData', 'CabinetDataController@setCabinetDetailData');
    $router->get('cabinet-monitor/{id?}', 'CabinetDataController@monitor');
    $router->post('initCabinetMonitorChart', 'CabinetDataController@initCabinetMonitorChart');
    $router->post('pollingCabinetMonitorData', 'CabinetDataController@pollingCabinetMonitorData');
    $router->post('getCabinetMonitorData', 'CabinetDataController@getCabinetMonitorData');
    $router->post('getCabinetMonitorChart', 'CabinetDataController@getCabinetMonitorChart');
    $router->get('cabinet-history/{id?}', 'CabinetDataController@history');
    $router->delete('cabinet-history/{idx?}/{id}', 'CabinetDataController@destroy');
    $router->post('getNewHistoryUrl', 'CabinetDataController@getNewHistoryUrl');
    $router->get('cabinet-compare/{id?}', 'CabinetDataController@compare');
    $router->get('cabinet-custom/{projectId?}/{id?}', 'CabinetDataController@custom');
    $router->post('getPointsByCabinetId', 'CabinetDataController@getPointsByCabinetId');
    $router->post('getChartByPoint', 'CabinetDataController@getChartByPoint');
    $router->get('upload-to-chart/{pid}', 'UploadToChartController@index');
    $router->post('getUploadChart', 'UploadToChartController@getUploadChart');
    //电源柜报警设置
    // $router->resource('cabinet-alarms', CabinetAlarmController::class);
    $router->get('cabinet-alarms/{boxId}', 'CabinetAlarmController@index');
    $router->get('cabinet-alarms/{boxId}/create', 'CabinetAlarmController@create');
    $router->post('cabinet-alarms/{boxId}', 'CabinetAlarmController@store');
    $router->get('cabinet-alarms/{boxId}/{id}', 'CabinetAlarmController@show');
    $router->get('cabinet-alarms/{boxId}/{id}/edit', 'CabinetAlarmController@edit');
    $router->put('cabinet-alarms/{boxId}/{id}', 'CabinetAlarmController@update');
    $router->delete('cabinet-alarms/{boxId}/{id}', 'CabinetAlarmController@destroy');
    //实况文本
    $router->get('cabinet-live-texts/{boxId}', 'CabinetLiveTextController@index');
    $router->get('cabinet-live-texts/{boxId}/create', 'CabinetLiveTextController@create');
    $router->post('cabinet-live-texts/{boxId}', 'CabinetLiveTextController@store');
    $router->get('cabinet-live-texts/{boxId}/{id}', 'CabinetLiveTextController@show');
    $router->get('cabinet-live-texts/{boxId}/{id}/edit', 'CabinetLiveTextController@edit');
    $router->put('cabinet-live-texts/{boxId}/{id}', 'CabinetLiveTextController@update');
    $router->delete('cabinet-live-texts/{boxId}/{id}', 'CabinetLiveTextController@destroy');

    $router->get('api/cabinet_id', 'CabinetAlarmController@cabinet_id');
    $router->get('api/point_id', 'CabinetAlarmController@point_id');
    //电源柜报警日志
    // $router->resource('cabinet-alarm-logs', CabinetAlarmLogController::class);
    $router->get('cabinet-alarm-logs/{pid}', 'CabinetAlarmLogController@index');
    $router->get('api/cabinet_pid', 'CabinetAlarmLogController@cabinet_pid');
    $router->get('api/alarm_id', 'CabinetAlarmLogController@alarm_id');
    //开关
    $router->resource('switches', SwitchController::class);
    $router->get('switch-children/{pid}', 'SwitchChildrenController@index');
    $router->get('switch-children/{pid}/create', 'SwitchChildrenController@create');
    $router->post('switch-children/{pid}', 'SwitchChildrenController@store');
    $router->get('switch-children/{pid}/{id}', 'SwitchChildrenController@show');
    $router->get('switch-children/{pid}/{id}/edit', 'SwitchChildrenController@edit');
    $router->put('switch-children/{pid}/{id}', 'SwitchChildrenController@update');
    $router->delete('switch-children/{pid}/{id}', 'SwitchChildrenController@destroy');
    //开关数据
    $router->get('switch-realtime/{projectId?}/{id?}', 'SwitchDataController@realtime');
    $router->post('getSwitchRealtimeData', 'SwitchDataController@getSwitchRealtimeData');
    $router->get('switch-realtime-detail/{projectId?}/{id?}', 'SwitchDataController@realtimeDetail');
    $router->post('getSwitchRealtimeDetailData', 'SwitchDataController@getSwitchRealtimeDetailData');
    $router->get('switch-monitor/{id?}', 'SwitchDataController@monitor');
    $router->post('getSwitchMonitorData', 'SwitchDataController@getSwitchMonitorData');
    $router->post('getSwitchMonitorChart', 'SwitchDataController@getSwitchMonitorChart');
    $router->post('setSwitchStatus', 'SwitchDataController@setSwitchStatus');
    $router->get('switch-history/{id?}', 'SwitchDataController@history');

    //电池
    $router->resource('batteries', BatteryController::class);

    //秒级数据(临时)
    $router->get('cabinet-history-second/{id?}', 'CabinetDataSecondController@history');
    $router->delete('cabinet-history-second/{idx?}/{id}', 'CabinetDataSecondController@destroy');
    $router->get('cabinet-history-line-second/{id?}', 'CabinetDataSecondController@historyLine');
    $router->post('getHistoryLineChart', 'CabinetDataSecondController@getHistoryLineChart');
    $router->post('getHistoryLineChartPage', 'CabinetDataSecondController@getHistoryLineChartPage');
    $router->get('cabinet-compare-second/{id?}', 'CabinetDataSecondController@compare');
    //备份数据(excel)
    $router->get('cabinet-second-backup/{boxId}', 'CabinetDataSecondBackupController@index');
    $router->delete('cabinet-second-backup/{boxId}/{id}', 'CabinetDataSecondBackupController@destroy');
    //新首页
    $router->get('new-index', 'NewIndexController@index');
    //物联卡
    $router->resource('iot-cards', IotCardController::class);


    //除尘
    $router->group(['prefix' => 'dedusting'], function(Router $router)
    {
        $router->resource('project', Dedusting\ProjectController::class);
        $router->resource('company', Dedusting\CompanyController::class);
        $router->resource('devices', Dedusting\DeviceController::class);
        $router->resource('repairs', Dedusting\RepairController::class);
        $router->resource('libraries', Dedusting\LibraryController::class);
        $router->resource('alarms', Dedusting\AlarmController::class);
        $router->get('api/libraries', 'Dedusting\LibraryController@libraries');
        $router->resource('alarm-logs', Dedusting\AlarmLogController::class);
        $router->resource('feedbacks', Dedusting\FeedbackController::class);
        $router->resource('point-ranges', Dedusting\PointRangeController::class);
        $router->resource('adjustments', Dedusting\AdjustmentController::class);
        $router->resource('consumables', Dedusting\ConsumableController::class);
        $router->get('history/{id}/{points?}', 'Dedusting\HistoryController@index');
        $router->resource('users', Dedusting\UserController::class);
    });
});
